#构建一个地图对象
from pyecharts.charts import Map
from pyecharts.options import VisualMapOpts
from pyecharts.render.engine import render

map=Map()

#准备数据

data=[("台湾省",100),("广东省",299),("北京市",122)]

#添加数据
map.add('测试的地图',data,'china')

#设置全局选项

map.set_global_opts(
    visualmap_opts=VisualMapOpts(
        is_show=True,
        is_piecewise=True,
        pieces=[
            {"min" : 1, "max" : 99,"label": '0-100',"color":"yellow"},
            {"min" : 100, "max": 199,"label": '200-100',"color" :"red"},
            {"min" : 200, "max": 1300,"label": '200-300',"color":"blue"}
        ]
    )

)

map.render("map.html")